import request from '@/utils/request'

export function buildMenus() {
  return request({
    url: '/sys/menu/nav',
    method: 'get'
  })
}

export function add(data) {
  return request({
    url: '/sys/menu/save',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: `/sys/menu/delete/${ids[0]}`,
    method: 'post'
  })
}

export function edit(data) {
  return request({
    url: '/sys/menu/update',
    method: 'post',
    data
  })
}

export function getMenuList() {
  return request({
    url: '/sys/menu/list',
    method: 'get'
  })
}

export default { add, edit, del }
